
import $ from 'jquery'

class LoginComponent extends React.Component {
	constructor(props) {
		super(props)
		this.state = {

		}
	}
	
	componentDidMount(){
		
		
    }
	
	check_login(){
		if(localStorage.getItem('aaa')){
			var Login_Pass = JSON.parse(localStorage.getItem('aaa')).password;
			var Login_Phone = JSON.parse(localStorage.getItem('aaa')).passphone
	
			if($('.login_username').val()==Login_Phone&& $('.login_userpass').val()==Login_Pass){
				alert('登录成功')
				$('.login_tip').css('display','none')
				$(location).attr('href', '#/')
			}else{
				alert('请输入正确的账户信息')
				$('.login_tip').css('display','block')
			}
		}else{
			alert('请输入正确的账户信息')
			$('.login_tip').css('display','block')
		}
		
	}
	
	
	
	render() {
		return(
			<div className="login">
				<header>
					<a href="#/" className="logo"></a>
					<span className="logo_text">登录</span>
				</header>
				<div className="form">
					<ul>
						<li className="userName">
							<div className="input_wrp"><input type="text" className="login_username" placeholder="你的手机号/邮箱"/></div>
						</li>
						<li className="userPass">
							<div className="input_wrp"><input type="password" className="login_userpass" placeholder="密码"/></div>
							<div className="form_text"><p className="login_tip">用户名或密码错误</p></div>
						</li>
						<li className="btn_box">
							<a className="btn btn_login" onClick={this.check_login}>立即登录</a>
							<a className="btn btn_reg" href='#/reg'>注册</a>
						</li>
						<li className="sns">
							<div className="splitter">
								<span className="sns_title">第三方合作平台登录</span>
							</div>
							<a className="btn weibo"></a>
							<a className="btn qq"></a>
						</li>
					</ul>
				</div>
			</div>
		)
	}
}

export default LoginComponent